//index.js
//获取应用实例
const app = getApp()
const {
  myRequest
} = require('../../tools/myRequest.js')
Page({
  data: {
    videos: [],
    vindex: 0,
    controls: false
  },
  //事件处理函数
  clickHandel() {
  this.setData({
      vindex:this.data.vindex+1
    
    })
  
  },
  clickHandel2() {
    if (this.data.vindex < 0) { this.data.vindex = 0 }
    this.setData({
      vindex: this.data.vindex -1
    })

  },


  onLoad: function() {

    myRequest('http://api.52170.xin/video?page_size=100', 'get').then(result => {
      var list = []
      for (var i = 0; i < result.data.data.list.length; i++) {
        list.push({
          video_url: result.data.data.list[i].video_url,
          video_tit: result.data.data.list[i].video_describe
        })
      }

      this.setData({
        videos: list
      })

    })
  }


})